package com.jsnkj.basic.dialog

import android.app.Activity
import android.app.Dialog
import android.os.Bundle
import android.view.View
import android.widget.FrameLayout
import android.widget.TextView
import com.jsnkj.basic.R


/**
 * 打开红包弹窗
 */
class OpenResultDialog(var dialogContext: Activity) :
    Dialog(dialogContext), View.OnClickListener {

    var tvMoney: TextView? = null
    var frameLayoutAd: FrameLayout? = null

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.dialog_open_result)
        setCanceledOnTouchOutside(false)
        setCancelable(true)
        window?.setBackgroundDrawableResource(android.R.color.transparent)


        tvMoney = findViewById(R.id.tv_money)

        findViewById<TextView>(R.id.tv_immediate_claim).setOnClickListener(this)

        frameLayoutAd = findViewById(R.id.fl_ad)

        //加载信息流
//        AdvertisementManager.loadFeed(
//            dialogContext, 300, 169,
//            object : com.tb.mob.TbManager.FeedLoadListener {
//                override fun onFail(p0: String?) {
//                    BurialPointUtil.flowAdEvent("fail")
//                }
//
//                override fun onLoad(feedPosition: FeedPosition) {
//                    BurialPointUtil.flowAdEvent("show");
//                    feedPosition.showFeed(dialogContext, frameLayoutAd)
//                }
//
//                override fun onDismiss() {
//
//                }
//
//                override fun onClicked() {
//
//                }
//
//                override fun onExposure(position: Position?) {
//                    position?.let {
//                        RewardsUtil.addGoldNumber(it.ecpm, RewardsConfig.adStream)
//                    }
//                }
//
//                override fun onVideoReady() {
//
//                }
//
//                override fun onVideoComplete() {
//
//                }
//
//            })

    }


    fun showDialog(money: String) {
        this.show()

        if (null == tvMoney) {
            tvMoney = findViewById(R.id.tv_money)
        }
        tvMoney?.text = money
    }


    override fun onClick(view: View) {
        dismiss()
    }



}